#import section
import random
import time
class alien:
    def __init__(self, xpos = random.randint(0, 100), ypos = random.randint(80, 100), dropSpeed = 2):
        self.xpos = xpos
        self.ypos = ypos
        self.dropSpeed = dropSpeed
        self.lastMove = time.time()
        self.fireSpeed = time.time()
        self.fireState = 0

    def move(self):
        x = random.randint(0, 3)
        if time.time() >= self.lastMove + 0.15:
            self.lastMove = time.time()
            if x == 1:
                self.xpos -= 1
            elif x == 2:
                self.xpos += 1
            self.ypos -= self.dropSpeed

    def getxpos(self):
        return self.xpos

    def getypos(self):
        return self.ypos

    def laserFire(self):
        if time.time() > self.fireSpeed + 0.25:
            if self.fireState <= 2:
                self.fireState += 1
            else:
                self.fireState = 0
        return self.fireState

